package beans;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import br.com.sigcoap.interfaces.IBaseEntity;

/**
 * The persistent class for the tb_aluno database table.
 * 
 */
@Entity
@Table(name = "tb_aluno")
@NamedQuery(name = "Aluno.findAll", query = "SELECT a FROM Aluno a")
public class Aluno implements IBaseEntity<Long> {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_aluno")
	private Long idAluno;

	@Temporal(TemporalType.TIMESTAMP)
	private Date dt_dataNasc;

	@Lob
	@Column(name = "nr_cpf")
	private String nrCpf;

	@Column(name = "nr_rg")
	private int nrRg;

	@Column(name = "tx_nome")
	private String txNome;

	@Column(name = "tx_turno")
	private String txTurno;

	// bi-directional many-to-one association to Endereco
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_endereco")
	private Endereco tbEndereco;

	// bi-directional many-to-many association to Disciplina
	@ManyToMany
	@JoinTable(name = "tb_disciplina_aluno", joinColumns = { @JoinColumn(name = "id_aluno") }, inverseJoinColumns = { @JoinColumn(name = "id_disciplina") })
	private List<Disciplina> tbDisciplinas;

	public Aluno() {
	}

	public Long getId() {
		return this.idAluno;
	}

	public void setId(Long idAluno) {
		this.idAluno = idAluno;
	}

	public Date getDt_dataNasc() {
		return this.dt_dataNasc;
	}

	public void setDt_dataNasc(Date dt_dataNasc) {
		this.dt_dataNasc = dt_dataNasc;
	}

	public String getNrCpf() {
		return this.nrCpf;
	}

	public void setNrCpf(String nrCpf) {
		this.nrCpf = nrCpf;
	}

	public int getNrRg() {
		return this.nrRg;
	}

	public void setNrRg(int nrRg) {
		this.nrRg = nrRg;
	}

	public String getTxNome() {
		return this.txNome;
	}

	public void setTxNome(String txNome) {
		this.txNome = txNome;
	}

	public String getTxTurno() {
		return this.txTurno;
	}

	public void setTxTurno(String txTurno) {
		this.txTurno = txTurno;
	}

	public Endereco getTbEndereco() {
		if(tbEndereco == null){
			tbEndereco = new Endereco();
		}
		return this.tbEndereco;
	}

	public void setTbEndereco(Endereco tbEndereco) {
		this.tbEndereco = tbEndereco;
	}

	public List<Disciplina> getTbDisciplinas() {
		return this.tbDisciplinas;
	}

	public void setTbDisciplinas(List<Disciplina> tbDisciplinas) {
		this.tbDisciplinas = tbDisciplinas;
	}

}